<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="">
	<meta name="author" content="">
	<title>Dashboard Template for Bootstrap</title>
	<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
	<link th:href="@{/css/dashboard.css}" rel="stylesheet">
	<style type="text/css">
		/* Chart.js */
		@-webkit-keyframes chartjs-render-animation {
			from {
				opacity: 0.99
			}
			to {
				opacity: 1
			}
		}
		@keyframes chartjs-render-animation {
			from {
				opacity: 0.99
			}
			to {
				opacity: 1
			}
		}
		.chartjs-render-monitor {
			-webkit-animation: chartjs-render-animation 0.001s;
			animation: chartjs-render-animation 0.001s;
		}
	</style>
</head>
<body >
<!--	顶部导航栏  list中的  顶部 和侧边栏都进行删除  然后去dashboard.html 中 定义 th:fragment="topbar" 用来做插入部分 注意模板引擎语法-->
<!-- <div th:insert="~{dashboard::topbar}"></div>   进行了  公共 页面抽取后就要重新命名插入  各种公共部分都可以抽取 -->
<div th:insert="~{commons/commons::topbar}"></div>   进行了  公共 页面抽取后就要重新命名插入 -->
<!--侧边栏-->
<div class="container-fluid">
	<div class="row">
		<!-- 第一 侧边栏 将原有的list中的侧边栏删除  二 dashboard.html 中 找侧边栏 定义 th:fragment="sidebar 三：进行下边的插入操作
        顶部导航栏也是一样的操作-->
		<!--				<div th:insert="~{dashboard::sidebar}" ></div>-->
		<div th:insert="~{commons/commons::sidebar}" ></div>
		<!--            这下面就只剩 内容了-->
		<!--				将数据库数据 遍历得到-->
		<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
			<h2>员工信息</h2>
            <h3><a class="btn btn-sm btn-success" th:href="@{/toadd}">添加员工</a></h3>
           <!--增加员工信息	编辑 增加按钮-->
			<div class="table-responsive">
				<table class="table table-striped table-sm">
					<thead>
					<tr>
						<th>员工id</th>
						<th>员工姓名</th>
						<th>邮箱</th>
						<th>性别</th>
						<th>所属部门</th>
						<th>出生日期</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
					<tr th:each="emp:${emps}">
						<td th:text="${emp.getId()}"></td>
						<td th:text="${emp.getLastName()}"></td>
						<td th:text="${emp.getEmail()}"></td>
						<td th:text="${emp.getGender()==0?'女':'男'}"></td>
						<td th:text="${emp.getDepartment().getDepartmentName()}"></td>
						<td th:text="${#dates.format(emp.getBrith(),'yyyy-MM-dd')}"></td>
						<td>
<!--							官方文档格式  th:href="@{'/emp/'+${emp.getId()}}"-->
<!--							<a class="btn btn-sm btn-primary" th:href="@{/emp/}+${emp.getId()}">修改</a>-->

							<a class="btn btn-sm btn-primary" th:href="@{'/emp/'+${emp.getId()}}">修改</a>
							<!--	id是私有的 需要getID哈	思路：改为a标签 点击编辑按钮 应该跳转到编辑的页面  修改完后再跳转会list页面并更新页面-->
							<a class="btn btn-sm btn-danger" th:href="@{'/delemp/'+${emp.getId()}}">删除</a>
						</td>
					</tr>
					</tbody>
				</table>
			</div>
		</main>
	</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="asserts/js/popper.min.js"></script>
<script type="text/javascript" src="asserts/js/bootstrap.min.js"></script>
<!-- Icons -->
<script type="text/javascript" src="asserts/js/feather.min.js"></script>
<script>
	feather.replace()
</script>
<!-- Graphs -->
<script type="text/javascript" src="asserts/js/Chart.min.js"></script>
<script>
	var ctx = document.getElementById("myChart");
	var myChart = new Chart(ctx, {
		type: 'line',
		data: {
			labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
			datasets: [{
				data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
				lineTension: 0,
				backgroundColor: 'transparent',
				borderColor: '#007bff',
				borderWidth: 4,
				pointBackgroundColor: '#007bff'
			}]
		},
		options: {
			scales: {
				yAxes: [{
					ticks: {
						beginAtZero: false
					}
				}]
			},
			legend: {
				display: false,
			}
		}
	});
</script>
</body>
</html>